Skip to content

fix: intword decillion to googol gap returns 0.0 googol - #454

Closed
agbesiprincekwabena-cmd wants to merge 4 commits into
python-humanize:mainfrom
agbesiprincekwabena-cmd:fix-356-intword-decillion
Closed

agbesiprincekwabena-cmd wants to merge 4 commits into
python-humanize:mainfrom
agbesiprincekwabena-cmd:fix-356-intword-decillion

Conversation

@agbesiprincekwabena-cmd

Copy link
Copy Markdown

Fixes #356 and #86

Problem
powers jumps from 1033 (decillion) to 10100 (googol) - gap is 10**67, not 1000.
Old check format % chopped == 1000 caused:

  • 10**36 -> "0.0 googol" (should be "1000.0 decillion" or plain number)
  • Huge decillion counts like 1000000.0 decillion for values in the gap

Solution
Compare to actual gap: powers[ordinal] // powers[ordinal-1]

  • If rounded value equals the gap, carry to next unit (googol)
  • Otherwise keep as decillion

Before:
intword(10**36) = '0.0 googol'

After:
intword(1036) = '1000.0 decillion'
intword(10
33 + 81//10) = plain number (gap fix)

Tests: 44 intword tests passed

@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.28%. Comparing base (392aef7) to head (fb9f74e).
⚠️ Report is 7 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (392aef7) and HEAD (fb9f74e). Click for more details.

HEAD has 18 uploads less than BASE
Flag BASE (392aef7) HEAD (fb9f74e)
ubuntu-latest 9 0
macos-latest 9 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #454      +/-   ##
==========================================
- Coverage   99.69%   93.28%   -6.42%     
==========================================
  Files          12       12              
  Lines         996      998       +2     
==========================================
- Hits          993      931      -62     
- Misses          3       67      +64     
Flag Coverage Δ
macos-latest ?
ubuntu-latest ?
windows-latest 93.28% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hugovk

hugovk commented Oct 20, 2026

Copy link
Copy Markdown
Member

CI fails.

Duplicate of #415.

@hugovk hugovk closed this Oct 20, 2026
@hugovk hugovk reopened this Oct 20, 2026
@hugovk hugovk closed this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

intword: values between 10^36 and a googol format as huge decillion counts, and rounding to the next unit does not carry

2 participants